/**      
 * @file		returnStruct.cpp
 * @description		This example demonstrates how to return a
 *			structure from a function. Since a struct
 *			is a user defined type we can use it just
 *			as we would any other type provided by c++.
 *			Cool huh!
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
#include <cstring>
using namespace std;

// My naming convention defines class types
// with an uppercase first character
// as Student, not student
// This lets other programmers visually see
// that they are working with a type and not
// a variable
struct Student {
	char mName[256];
	char mSID[256];
};

/**
 * This function initializes a Student with the provided
 * name and student id.
 * @param aName the name to give the student
 * @param aSID the student id to give the student
 * @return the created student
 */
Student getStudentInfo(char aName[], char aSID[]);

/**
 * This function outputs the data in a student. Namely
 * a student's name and their student id.
 * @param aStudent the student to output to standard output
 */
void outputStudentInfo(const Student& aStudent);

/**
 * @return zero if the application executes successfully
 */
int main() {
	Student studentOne;
	Student studentTwo;

	studentOne = getStudentInfo("John Doe", "22345");
	studentTwo = getStudentInfo("Jane Doe", "23443");

	outputStudentInfo(studentOne);
	outputStudentInfo(studentTwo);

	return 0;
}

Student getStudentInfo(char aName[], char aSID[]) {
	Student aStudent;
	// Remember we can't use the assignment operator
	// to set values to cStrings. However, we could use
	// the assignment operator if we used the string
	// class. 
	// Also, remember that the strcpy function throws
	// a warning message in VS 2005
	strcpy(aStudent.mName, aName);
	strcpy(aStudent.mSID, aSID);
	return aStudent;
}

void outputStudentInfo(const Student& aStudent) {
	cout << "Name: " << aStudent.mName << endl;
	cout << "SID: " << aStudent.mSID << endl;
}

